package com.myapp.model.impl.product;

import java.util.HashMap;
import java.util.Map;
import org.mybatis.spring.SqlSessionTemplate;
import com.myapp.model.dao.product.PictureDao;
import com.myapp.model.entity.product.Picture;

public class PictureDaoImpl implements PictureDao {

	private SqlSessionTemplate sqlDao;
	
	public void setSqlDao(SqlSessionTemplate sqlDao) {
		this.sqlDao = sqlDao;
	}

	@Override
	public Picture addPicture(Picture pic) {
		int id = sqlDao.insert("addPicture", pic);
		pic.setId(id);
		return pic;
	}
	
	public void updateProduct(int oldProdId, int prodId){
		Map<String,Integer> paramMap = new HashMap<String,Integer>();
		paramMap.put("oldProdId",oldProdId);
		paramMap.put("prodId",prodId);
		sqlDao.update("updateProduct",paramMap);
	}
}
